import java.util.concurrent.locks.ReentrantLock;

public class LockTest {
    public static void main(String[] args) {
         ReentrantLock reentrantLock = new ReentrantLock();
        new Thread(()->{
            reentrantLock.lock();
            try {
                System.out.println( Thread.currentThread().getName() + " do some thing");
            }finally {
                reentrantLock.unlock();
            }
        }).start();

    }
}
